<!DOCTYPE html>
<html lang="zxx">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">

	<link rel="icon" href="images/favicon.png">
	<title></title>

	<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
	<link rel="stylesheet" href="css/materialize.css">
	<link rel="stylesheet" href="css/loaders.css">
	<link rel="stylesheet" href="css/lightbox.css">
	<link rel="stylesheet" type="text/css" href="http://www.jq22.com/jquery/font-awesome.4.6.0.css">
	<link rel="stylesheet" href="css/owl.carousel.min.css">
	<link rel="stylesheet" href="css/owl.theme.default.min.css">
	<link rel="stylesheet" href="css/style.css">
	    <link rel="stylesheet" href="css/layer.css">

</head>
<style>

</style>
<body>
	
	<!-- navbar -->
	<div class="navbar">
		<div class="container">
			<div class="row">
				<div class="col s9">
					<div class="content-left" onclick="javascript:history.back('index.html');">
					<i class="fa fa-chevron-left center"></i>
										</div>
				</div>
				
			</div>
		</div>
	</div>
	<!-- end navbar -->
	
	<!-- sidebar -->
	
	<!-- end sidebar -->

	<!-- table -->
<div class="segments-page">
		<div class="container" style=" width: 90%;">
			<div class="pages-title">
				<h3>积分转换</h3>
				<div class="line"></div>
			</div>
			<div class="total-pay">
				<div class="row">
					<div class="col s8">
						<div class="contents">
							<p>充值积分</p>
						</div>
					</div>
					<div class="col s4">
						<div class="contents right">
							<p id="up_integral"></p>
						</div>
					</div>
					<div class="col s8">
						<div class="contents">
							<p>静态积分</p>
						</div>
					</div>
					<div class="col s4">
						<div class="contents right">
							<p id="qcore"></p>
						</div>
					</div>
					<div class="col s8">
						<div class="contents">
							<p>动态积分</p>
						</div>
					</div>
					<div class="col s4">
						<div class="contents right">
							<p id="score"></p>
						</div>
					</div>
				
				</div>
			</div>
			
			<div class="checkout">
					<form id="form" onsubmit="return false" action="##" method="post">
						      <input type="hidden" name="Member_account" id="Member_id" value="">
					 <input type="text" readonly="readonly"  placeholder="积分类型" id="Member_account">
					<input type="number"min="1" name="number" placeholder="数量">
					<input type="password" name="TradersPassword" placeholder="交易密码">
					<button class="button checkout-button " onclick="transform();"><i class="fa fa-send"></i>转换</button>
				</form>
			</div>
			
		</div>
	</div>
	<div class="pages-title">
			<h3>转换流水</h3>
			<div class="line"></div>
			<div class="list_box table-contents z-depth-1" style="min-height: 200px;padding: 0px 10px 0;" >
					<table>
						<thead>
							<tr>
									<th>记录</th>
									
									<th>时间</th>
							</tr>
							
						</thead>
						<tbody id="container">
						  
						</tbody>
						
					</table>
		</div>
	</div>
	<!-- end table -->
	<script src="js/jquery.min.js"></script>
	<script src="js/materialize.js"></script>
	<script src="js/owl.carousel.min.js"></script>
	<script src="js/main.js"></script>
	<script src="js/jquery.min.js"></script>
	<script src="js/materialize.js"></script>
	<script src="js/numscroller.js"></script>
	<script src="js/lightbox.js"></script>
	<script src="js/owl.carousel.min.js"></script>
	<script src="js/main.js"></script>
	<script src="js/layer.js"></script>
	<script src="js/jquerysession.js"></script>
	<script src="http://www.gongjuji.net/Content/files/jquery.md5.js"></script>
	<script src="js/index.js"></script>
	<script src="js/mobileSelect.js"></script>
<script>

	$(document).ready(function () {
	    var GetActivationurl = 'Member/index';
	    var GetActivationInfo = api_request(GetActivationurl, 'GET');
		
	    if(GetActivationInfo.code==1){
			var  up_integral=GetActivationInfo.data.data.up_integral; //当前会员充值积分
			var  qcore=GetActivationInfo.data.data.qcore; //当前会员静态积分
			var  score=GetActivationInfo.data.data.score; //当前会员动态积分
			
			var up_integralhtml = document.getElementById("up_integral");//当前会员充值积分
			up_integralhtml.innerHTML += up_integral;
			
			var qcorehtml = document.getElementById("qcore");//当前会员静态积分
			qcorehtml.innerHTML += qcore;
			var scorehtml = document.getElementById("score");//当前会员动态积分
			scorehtml.innerHTML += score;
			
			
			var Billurl = 'Bill/Bill?type=6&genre=1';
				var BillInfo = api_request(Billurl, 'GET');
				var data=BillInfo.data
				if(data){
					var html = "";
					for(var i=0;i<data.length;i++){
						 var ls=data[i];
						html="<tr><td>"+ls.details+"</td><td>"+ls.add_time+"</td></tr>"
						   $('#container').append(html);
					}
				}else{
					html="暂未有记录"
					var container = document.getElementById("container");
					container.innerHTML += html;
				}
			}

	 }); 
	 var accounturl = 'cms/label/name/Member_account'; //转换类型接口
	 var accountInfo = api_request(accounturl, 'GET');
	
	 if (accountInfo.data) {
	     var accountResult = accountInfo.data.split(',');
	     var arr = [];
	     for (var i = 0; i < accountResult.length; i++) {
	         arr.push({
	             'id': i,
	             'value': accountResult[i],
	         });
	     }
	 }
	
	 var mobileSelect1 = new MobileSelect({
	     trigger: '#Member_account',
	     title: '积分类型',
	     wheels: [
	         {data: arr}
	     ],
	     transitionEnd: function (indexArr, data) {
	 
	     },
	     callback: function (indexArr, data) {
			  $('#Member_account').attr('placeholder', data[0].value)
	 		   $("#Member_id").val(data[0].id)
	     }
	 });
	 function transform(){
		   var params = $('#form').serializeObject();
		
		   if(!params.Member_account){
			   layer.open({
			       content: '请选择积分类型!'
			       , skin: 'msg'
			       , time: 2 //2秒后自动关闭
			   });
			   return false;
		   }
		   if(!params.number){
		   			   layer.open({
		   			       content: '请输入数量!'
		   			       , skin: 'msg'
		   			       , time: 2 //2秒后自动关闭
		   			   });
		   			   return false;
		   }
		   if(!params.TradersPassword){
		   			   layer.open({
		   			       content: '请输入交易密码!'
		   			       , skin: 'msg'
		   			       , time: 2 //2秒后自动关闭
		   			   });
		   	  return false;
		   }
		   layer.open({
		     content:"确定转换吗?"
		     ,btn: ['确定', '取消']
		     ,yes: function(index){
		       var deliveryurl = 'Member/transform';
		   					  var deliveryInfo = api_request(deliveryurl, 'POST',params);
		   					  if(deliveryInfo.code==1){
		   						layer.open({
		   						    content: deliveryInfo.data
		   						    , skin: 'msg'
		   						    , time: 2//2秒后自动关闭
		   						    , end: function () {
		   								   location.reload();
		   						    }
		   						});
		   					  }
		     }
		   });
	
	 }

</script>
</body>
</html>